import pandas as pd
from datetime import datetime

# 读取CSV文件
df = pd.read_csv('911.csv')

# 将timeStamp列从字符串转换为datetime对象
df['timeStamp'] = pd.to_datetime(df['timeStamp'])

# 从datetime对象中提取出年份和周的编号（ISO周）
df['year'] = df['timeStamp'].dt.year
df['week'] = df['timeStamp'].dt.isocalendar().week

# 按照年和周以及电话类型进行分组并计数
grouped = df.groupby(['year', 'week', 'title']).size().reset_index(name='count')


# 打印结果以查看前几行
print(grouped)